package com.qi.springcloud.serviceorder.controller;


import com.qi.springcloud.serviceorder.bean.Order;
import com.qi.springcloud.serviceorder.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 源码学院-Fox
 * 只为培养BAT程序员而生
 * http://com.qi.springcloud
 * 往期视频加群:516212256 暗号:6
 */
@RestController
@RequestMapping("/order")
public class OrderController {


    @Autowired
    private OrderService orderService;

    @RequestMapping("/getById/{id}")
    public Order getById(@PathVariable("id") Integer id) {
        Order order = orderService.getById(id);
        return order;
    }

    @RequestMapping("/findOrderByUserId/{userId}")
    public List<Order> findOrderByUserId(@PathVariable("userId") Integer userId) {
        List<Order> list = orderService.findOrderByUserId(userId);
        return list;
    }


}
